//
//  GamePlayManager.h
//  popstar
//
//  Created by luyuhuang on 14/11/29.
//
//

#ifndef __popstar__GamePlayManager__
#define __popstar__GamePlayManager__

#include "coco2d-inl.h"
#include "Star.h"
#include "GamePlayLayer.h"


class GamePlayManager : public Node
{
public:
    
    static GamePlayManager* create(GamePlayLayer *layer);
    bool init();
    
    
    void updateMatrx();
    void initMatrix();
    void onTouch(const Point &p);
    Point getPositionByIndex(int i,int j);
   // void update
    
    
public:
    static const int MAXROW = 10;
    static const int MAXCOL = 10;
    static const int MAXCOLOR = 5;
private:
    
    
    Star* starMatrix[MAXROW][MAXCOL];
    
    GamePlayLayer *m_layer;
    Point getTouchOnStar(const Point &p);
    
    std::set<Point> sameColorStar(std::set<Point> p);
    
    void clearSelected();
    void clearGroupStar(std::set<Point> p);
};



#endif /* defined(__popstar__GamePlayManager__) */
